#@layout()

#define content()

    <section class="content-header">

        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-6">

                    <div class="row mb-2">
                        <div class="col-sm-12">
                            <h1>
                                登录注册
                                <small data-toggle="tooltip" title="" data-placement="right"
                                       data-trigger="hover"><i class="nav-icon far fa-question-circle"></i></small>
                                <small> 首页 / 系统 / 登录注册</small>
                            </h1>
                        </div>
                    </div>
                </div>
            </div>

        </div><!-- /.container-fluid -->
    </section>

    <section class="content">

        <div class="container-fluid">
                <div class="card card-outline card-primary">

                    <!-- /.card-header -->
                    <!-- form start -->
                    <form class=" form-setting" autocomplete="off" id="optionForm">
                        <div class="card-body">

                            <h4 class="form-header">后台第三方登录</h4>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">开启后台第三方登录功能</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery" data-for="admin_login_oauth2_enable"
                                           #checkedIf(option('admin_login_oauth2_enable'))>
                                    <input type="hidden" id="admin_login_oauth2_enable" name="admin_login_oauth2_enable">
                                    <p class="text-muted"> 开启后，后台的第三方登录地址为：#option('web_domain','http://www.***.com')/admin/oauth2/login ，回调地址为：
                                        #option('web_domain','http://www.***.com')/admin/oauth2/callback </p>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">客户端 AppID</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" placeholder="请输入客户端 app id"
                                           name="admin_login_oauth2_appid"
                                           value="#option('admin_login_oauth2_appid')">
                                </div>
                            </div>


                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">客户端 App Secret</label>
                                <div class="col-sm-6">
                                    <input type="text" autocomplete="off" class="form-control" placeholder="客户端 App 的秘钥"
                                           name="admin_login_oauth2_secret"
                                           value="#option('admin_login_oauth2_secret')">
                                </div>
                            </div>


                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">授权 URL</label>
                                <div class="col-sm-6">
                                    <textarea rows="3" style="word-break: break-all" autocomplete="off" class="form-control" placeholder="第三方授权 URL"
                                           name="admin_login_oauth2_authorize_url">#option('admin_login_oauth2_authorize_url')</textarea>
                                    <p class="text-muted"> URL 支持的占位符有：{client_id} , {redirect_uri} , {timestamp} , {state} 。例如：
                                        https://www.***.com/oauth2.0/authorize?response_type=code&client_id={client_id}&redirect_uri={redirect_uri}&state={state}
                                    </p>
                                </div>
                            </div>



                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">Access Token 获取 URL</label>
                                <div class="col-sm-6">
                                    <textarea rows="3" style="word-break: break-all" autocomplete="off" class="form-control" placeholder="Access Token 获取 URL"
                                           name="admin_login_oauth2_token_url">#option('admin_login_oauth2_token_url')</textarea>
                                    <p class="text-muted"> URL 支持的占位符有：{client_id} , {client_secret} , {redirect_uri} , {code}  。例如：
                                        https://www.***.com/oauth2.0/getAccessToken?response_type=authorization_code&client_id={client_id}&client_secret={client_secret}&redirect_uri={redirect_uri}&code={code}
                                    </p>
                                </div>
                            </div>


                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">用户信息获取 URL</label>
                                <div class="col-sm-6">
                                    <textarea rows="3" style="word-break: break-all" autocomplete="off" class="form-control" placeholder="第三方用户信息 URL"
                                           name="admin_login_oauth2_profile_url">#option('admin_login_oauth2_profile_url')</textarea>
                                    <p class="text-muted"> URL 支持的占位符有：{client_id} , {client_secret} , {redirect_uri} , 以及 AccessToken 返回的相关参数 。例如：
                                        https://www.***.com/oauth2.0/userinfo?access_token={access_token}
                                    </p>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">登录后默认分配的部门</label>
                                <div class="col-sm-6">
                                    <select class="form-control" name="admin_login_oauth2_default_dept_id">
                                        #for(dept : departments)
                                        <option value="#(dept.id ??)" #selectedIf(option(
                                        'admin_login_oauth2_default_dept_id') == dept.id.toString()) >#(dept.layerString ??)#(dept.name ??)</option>
                                        #end
                                    </select>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">登录后默认分类的角色</label>
                                <div class="col-sm-6">
                                    <select class="form-control" name="admin_login_oauth2_default_role_id">
                                        #for(role : roles)
                                        <option value="#(role.id ??)" #selectedIf(option('admin_login_oauth2_default_role_id') == role.id.toString()) >#(role.name ??)</option>
                                        #end
                                    </select>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">登录成功后，跳转地址</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" placeholder="默认为：/admin/index"
                                           name="admin_login_oauth2_success_url"
                                           value="#option('admin_login_oauth2_success_url')">
                                    <p class="text-muted"> 注意：请确保该用户有访问这个地址的权限。</p>
                                </div>

                            </div>



                            <h4 class="form-header">前台用户登录</h4>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">登录须输入验证码</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery" data-for="login_captcha_enable"
                                           #checkedIf(option("login_captcha_enable","true"))>
                                    <input type="hidden" id="login_captcha_enable" name="login_captcha_enable">
                                </div>
                            </div>


                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">登录成功跳转地址</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" placeholder="例如：/ucenter"
                                           name="login_goto_url"
                                           value="#option('login_goto_url')">
                                    <p class="text-muted"> 不填写时，当用户登录成功后会跳转到用户中心 <a href="#(CPATH)/ucenter" target="_blank">/ucenter</a> 。</p>
                                </div>
                            </div>


                            <h4 class="form-header">用户注册</h4>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">开启注册功能</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery" data-for="reg_enable"
                                           #checkedIf(option("reg_enable","true"))>
                                    <input type="hidden" id="reg_enable" name="reg_enable">
                                </div>
                            </div>


                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">默认所有注册用户未激活</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery" data-for="reg_users_is_not_activate"
                                           #checkedIf(option("reg_users_is_not_activate"))>
                                    <input type="hidden" id="reg_users_is_not_activate" name="reg_users_is_not_activate">
                                    <p class="text-muted">
                                        开启此功能后，需要管理员在后台对用户进行手动激活。
                                    </p>
                                </div>
                            </div>


                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">启用邮件验证</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery" data-for="reg_email_validate_enable"
                                           #checkedIf(option("reg_email_validate_enable"))>
                                    <input type="hidden" id="reg_email_validate_enable"
                                           name="reg_email_validate_enable">
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">邮件标题</label>

                                <div class="col-sm-6">
                                    <input type="text" class="form-control" placeholder="例如：欢迎注册成为JPress会员"
                                           name="reg_email_validate_title"
                                           value="#option('reg_email_validate_title')">
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">邮件模板</label>
                                <div class="col-sm-6">
                                    <textarea rows="3" class="form-control" placeholder="例如：尊敬的#('#(user.nickname ??)')，欢迎注册成为JPress会员，请先点击链接 #('#(url)') 进行激活..."
                                              name="reg_email_validate_template">#option("reg_email_validate_template")</textarea>
                                    <p class="text-muted">
                                        请先在 <a href="#(CPATH)/admin/setting/connection">[通信]</a> 开启邮件功能后才能使用。
                                    </p>
                                </div>
                            </div>


                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">手机短信验证</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery" data-for="reg_sms_validate_enable"
                                           #checkedIf(option("reg_sms_validate_enable"))>
                                    <input type="hidden" id="reg_sms_validate_enable" name="reg_sms_validate_enable">
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">短信模板</label>
                                <div class="col-sm-6">
                                    <textarea rows="3" class="form-control" placeholder="..."
                                              name="reg_sms_validate_template">#option("reg_sms_validate_template")</textarea>
                                    <p class="text-muted">
                                        请先在 <a href="#(CPATH)/admin/setting/connection">[通信]</a> 开启短信功能，这里填写阿里云或腾讯云的短信模板ID。
                                    </p>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">短信签名</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" placeholder="只有部分服务商需要短信签名"
                                           name="reg_sms_validate_sign"
                                           value="#option('reg_sms_validate_sign')">
                                    <p class="text-muted"> 请填写阿里云或腾讯云的短信签名。</p>
                                </div>
                            </div>

                            <h4 class="form-header">重置密码</h4>
                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">邮件标题</label>

                                <div class="col-sm-6">
                                    <input type="text" class="form-control" placeholder="例如：JPress重置密码"
                                           name="reg_email_reset_pwd_title"
                                           value="#option('reg_email_reset_pwd_title')">
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">邮件模板</label>
                                <div class="col-sm-6">
                                    <textarea rows="3" class="form-control" placeholder="例如：#('#(user.nickname ??)') 先生/女士你好，如果忘记了密码，请点击链接#('#(url)') 进行密码重置..."
                                              name="reg_email_reset_pwd_template">#option("reg_email_reset_pwd_template")</textarea>
                                    <p class="text-muted">
                                        请先在 <a href="#(CPATH)/admin/setting/connection">[通信]</a> 开启邮件功能后才能使用。
                                    </p>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">短信模板</label>
                                <div class="col-sm-6">
                                    <textarea rows="3" class="form-control" placeholder="..."
                                              name="reg_sms_reset_pwd_template">#option("reg_sms_reset_pwd_template")</textarea>
                                    <p class="text-muted">
                                        请先在 <a href="#(CPATH)/admin/setting/connection">[通信]</a> 开启短信功能，这里填写阿里云或腾讯云的短信模板ID。
                                    </p>
                                </div>
                            </div>


                        </div>
                        <!-- /.card-body -->
                        <div class="card-footer">
                            <div class="offset-sm-2 col-sm-10 submit-block">
                                <div class="card-submit">
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </div>
                        <!-- /.card-footer -->
                    </form>
                </div>
            </div>

    </section>
#end
